//
//  SREvaluateView.m
//  SportRing
//
//  Created by elwin on 10/29/14.
//  Copyright (c) 2014 HotOne. All rights reserved.
//

#import "SREvaluateView.h"

const NSInteger imageDistance = 3;

@implementation SREvaluateView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (id)initWithSelectedImage:(UIImage *)selectedImage notSelectedImage:(UIImage *)notSelectedImage notSelectedCount:(NSInteger)notSelectedCount selectedCount:(NSInteger)selectedCount
{
    self = [super init];
    
    if (self) {
        
        self.frame = CGRectMake(0, 0, (notSelectedCount + selectedCount)*(selectedImage.size.width + imageDistance), 0);
        
        
        for (int i = 0; i< selectedCount; i++)
        {
            
            UIImageView *selectedImageView = [[UIImageView alloc] initWithImage:selectedImage];
            
            selectedImageView.frame = CGRectMake(i*(selectedImageView.frame.size.width + imageDistance), 0, selectedImageView.frame.size.width, selectedImageView.frame.size.height);
            
            [self addSubview:selectedImageView];
            
        }
        
        for (int i = 0; i< notSelectedCount; i++)
        {
            
            UIImageView *notSelectedImageView = [[UIImageView alloc] initWithImage:notSelectedImage];
            
            notSelectedImageView.frame = CGRectMake((i+selectedCount)*(notSelectedImageView.frame.size.width + imageDistance), 0, notSelectedImageView.frame.size.width, notSelectedImageView.frame.size.height);
            
            [self addSubview:notSelectedImageView];
            
        }
        
    }
    
    return self;
    
}


@end
